<?php

$area = substr($_FILES["imageFile"]["name"],0,7);

$dir = "./upload/$area/";

if (!file_exists($dir)){
    mkdir ($dir,0777,true);
}

$dir = "./upload/$area/".date("Ymd");
if (!file_exists($dir)){
    mkdir ($dir,0777,true);
}

move_uploaded_file($_FILES["imageFile"]["tmp_name"],
    $dir ."/" .$_FILES["imageFile"]["name"]);

//根据文件名对应不同的区域

$logdir = "./log/".date("Ymd");
if (!file_exists($logdir)){
    mkdir ($logdir,0777,true);
}
$fileName = $logdir."/"."uploadlog".date("Y").".log";
$content = "文件名：".$_FILES["imageFile"]["name"].";路径:".$dir."/".$_FILES["imageFile"]["name"];
$s = "\r\n--------------------------------------" .
    "\n\t上传时间：" . time() . ' 时期:' . date('Y-m-d H:i').
    "\n--------------------------------------\r\n";
file_put_contents($fileName, $s . var_export($content, true), FILE_APPEND);
